package com.dlc.felear.xiaoensale.utils;

import android.text.TextUtils;

import com.dlc.felear.xiaoensale.constant.Constant;
import com.dlc.felear.xiaoensale.entity.ConnectInfo;
import com.dlc.felear.xiaoensale.helper.JsonHelper;
import com.dlc.felear.xiaoensale.helper.Session;

public class SaveOrderInfo {
    private Session session;
    private String lastId;

    public SaveOrderInfo(Session session) {
        this.session = session;
    }

    public void saveOrderInfo(ConnectInfo.GoodsInfo goodsInfo) {
        if (!TextUtils.equals(goodsInfo.getGoodsId(), lastId)) {
            session.setString(Constant.MENU_INFO, JsonHelper.toJson(goodsInfo));
            lastId = goodsInfo.getGoodsId();
        }
    }
}
